<template>
  <FormItem :label="label" :prop="prop" :single="single">
    <paas-page-select :multiple="multiple" :disabled="see || disabled" :url="url" :vars="vars" :model-value="modelValue" @input="input" @change="change"></paas-page-select>
  </FormItem>
</template>
<script>

export default {
  name: "FormPageSelect",
  props: {
    multiple: {
      default: false
    },
    url: "",
    vars: {},
    modelValue: String,
    single: { default: false },
    disabled: { default: false },
    label: "",
    prop: ""
  },
  computed: {
    see() {
      return this.$store.forms.see;
    }
  },
  methods: {
    input(data) {
      this.$emit("update:modelValue", data);
      this.$emit("input", data);
    },
    change(data) {
      let value = new Array();
      if (!!this.multiple) {
        for (let i = 0; i < data.length; i++) {
          value.push(data[i].value);
        }
      } else {
        value = data.value;
      }
      this.$emit("update:modelValue", value);
      this.$emit("change", data);
    }
  }
};
</script>